package com.thirdDay;

import java.util.StringJoiner;

public class Demo11 {
    public static void main(String[] args) {

        StringJoiner joiner = new StringJoiner(",");
        String toString = joiner.add("aaa").add("bbb").add("ccc").toString();
        System.out.println(toString); // aaa,bbb,ccc

        // 间隔参数    最左边的参数(开始参数)    最右边的参数(结束参数)
        StringJoiner stringJoiner = new StringJoiner(",", "[", "]");
        String toString1 = stringJoiner.add("aaa").add("bbb").add("ccc").toString();
        System.out.println(toString1);

        int length = stringJoiner.length();
        System.out.println(length);

    }
}
